<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>添加对象的方法</title>
		<script type="text/javascript">
			var student = {}; 
			student.id = 100; 
			student.name = "刘强";
			student.gender = "男";
			student.dateofbirth = "2002-5-17";
			student.courses = []; 
			student.getName = function() { 
				return this.name; 
			}
			student.chooseCourse = function(courseName) { 
				student.courses.push(courseName); 
			}
            student.getName(); 
			student.chooseCourse("Web前端开发"); 
			student.chooseCourse("数据库原理及应用");
			student.chooseCourse("C#面向对象程序设计");
			document.write(student.getName()+"<br />");  
			document.write(student.courses);  
		</script>
	</head>
	<body>
	</body>
</html>
